(function () {
    var ajax = function () {

    };

    ajax.prototype = {
        get: function (url,params,callback) {
            debugger;
            var xhr = new XMLHttpRequest();
            xhr.onreadystatechange = function () {
                if (xhr.readyState == 4) {
                    callback(xhr.responseText);
                }
            }
            xhr.open("GET",`${url}?${params}`,true);
            xhr.send();
        },
        post: function (url, params, callback) {
            debugger;
            var xhr = new XMLHttpRequest();
            xhr.onreadystatechange = function () {
                if (xhr.readyState == 4) {
                    callback(xhr.responseText);
                }
            }
            xhr.open("POST", url,true);
            xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
            xhr.send(params);
        }
    }
    window.ajax=new ajax();

})();